package com.zhangwei.expands.fragment;


import android.view.View;
import android.widget.ListView;

import com.alibaba.fastjson.TypeReference;
import com.zhangwei.expands.adapter.DemoAdapter;
import com.zhangwei.expands.bean.Activities;
import com.zhangwei.expands.bean.ComApiBean;
import com.zhangwei.expands.utils.HttpUtils;

import java.util.ArrayList;

import cn.finalteam.okhttpfinal.RequestParams;

/**
 *
 */

public class TestFragment extends BasePtrFragment {
    private DemoAdapter adapter;

    private ArrayList<Activities> lsit = new ArrayList<Activities>();

    /**
     * 设置adapter
     * @param listview
     */
    @Override
    public void setAdapter(ListView listview) {
        adapter = new DemoAdapter(lsit, getActivity());
        listview.setAdapter(adapter);

    }

    @Override
    public int getLayoutid() {
        return super.getLayoutid();
    }

    /**
     * 添加头部
     * @return
     */
    @Override
    public View getHeadView() {
        return super.getHeadView();
    }

    /**
     * 加载数据
     */
    @Override
    protected void initData() {
        TypeReference<ComApiBean<Activities>> type = new TypeReference<ComApiBean<Activities>>() {
        };
        RequestParams params = new RequestParams();
        HttpUtils.post("", params, lsit, adapter, type);
    }

}
